<?php
function getLOHeader($layOut) {
	global $objSDAO;
	$sSQL = "SELECT l.*, m.description AS mdes , s.description AS sdes " .
		", s.functional_area, f.description AS fdes ".
		" FROM layout l ".
		" LEFT JOIN module m ON m.module = l.module " .
		" LEFT JOIN sub_module s ON s.sub_module = l.sub_module " .
		" LEFT JOIN functional_area f ON f.functional_area = s.functional_area " .
		" WHERE layout = '$layOut' ";
	$objSDAO->query($sSQL, "LOSHead");
	$row = $objSDAO->fetch("LOSHead");
	
	$sHtml = ("<table width=\"100%\" cellpadding=\"3\" cellspacing=\"2\">\n<tr>\n<td>\n");
	$sHtml .= ("<tr>" .
			"<td class=\"titl01\" width=\"15%\">Module</td>" .
			"<td class=\"text01\" width=\"85%\" style='font-weight:bold;'>".$row['module']." - ".$row['mdes']."</td>" .
		"</tr>\n<tr>\n".
			"<td class=\"titl01\" width=\"15%\">Functional-Area</td>" .
			"<td class=\"text01\" width=\"85%\" style='font-weight:bold;'>".$row['functional_area']." - ".$row['fdes']."</td>" .
		"</tr>\n<tr>\n".
				"<td class=\"titl01\" width=\"15%\">Sub-module</td>" .
			"<td class=\"text01\" width=\"85%\" style='font-weight:bold;'>".$row['sub_module']." - ".$row['sdes']."</td>" .
		"</tr>\n<tr>\n".
			"<td class=\"titl01\" width=\"15%\"><b>Layout name</b></td>" .
			"<td class=\"text01\" width=\"85%\" style='font-weight:bold;'><b>"
				.substr($row['layout'],10)." - ".$row['description']."</b></td>" .
		"</tr>\n");
	$sHtml .= ("</table>\n");
	return $sHtml;
}

function moduleCheck(){
	global $objSDAO;
	$errMsg = "";
	$sSQL = "SELECT * FROM module WHERE module='".addslashes(sxGPC($_REQUEST["module"]))."'";
	if($objSDAO->query($sSQL, "mod", array("contOnErr"=>true))){
		if($row = $objSDAO->fetch("mod")){
			return "";
		}else{
			$errMsg .= _t("Il modulo")." '".addslashes(sxGPC($_REQUEST["module"]))."' "._t("&egrave; inesistente");
			return $errMsg;
		}
	}else{
		$errMsg .= $sSQL."<br> - ".$objSDAO->error;
		return $errMsg;
	}
		
}

/**
 * ripulisce il fileName originale
 */
 function _elabFileName($nomeFile){
 		$elabFileName = ereg_replace('[^a-zA-Z 0-9 . - _]', "_", str_replace(" ", "_", $nomeFile));
 		return $elabFileName;
 }

?>
